<?php
/**
 * Created by PhpStorm.
 * User: dev
 * Date: 7/10/14
 * Time: 1:07 PM
 */

class Site_Widget_Recent_Controller extends Base_Controller {

    public $restful = true;

    public function __construct()
    {
        parent::__construct();
        //--Your Code --//
    }


    public function get_index($location=0){
        //--Show Parent Locations--//
        $limit = Config::get('Site::recent.count') ;


        if(Cache::get("recent_listing")){
            $result =  Cache::get("recent_listing");
        }else{

            $sql = "Select * from post where status=51 ORDER BY `id` DESC limit 0,$limit";
            $result = DB::query($sql);
            Cache::put('recent_listing', $result, 60*24*30);

        }

        $data['recent'] = $result;
        return View::make('Site::widget.recent',$data);
    }
}